#include "tcp_client.hpp"
#include <iostream>
int main(int argc, char *argv[])
{
    if (argc != 3)
    {
        printf("Usage ./udp_client [ip] [port]");
    }
    Tcp_client client(argv[1], atoi(argv[2]));
    bool ret=client.Connect();
    if(ret==0)
    {
        printf("client connect failed!\n");
        return 1;
    }
    while (1)
    {
        std::string word;
        std::cout << "please enter the word you want to find>";
        std::cin >> word;
        if (!std::cin)
        {
            std::cout << "bye bye bye" << std::endl;
            break;
        }
        client.SendTo(word);
        std::string result;
        client.RecvFrom(&result);
        std::cout<<word<<" means :"<<result<<std::endl;
    }

    return 0;
}